﻿using System;
using System.Collections.Generic;
using System.Xml.Linq;

namespace YArchitech.MEP
{
	public class HYPipeSpecifications : SortedSet<HYPipeSpecification>
	{
		public HYPipeSpecifications()
		{
		}

		public HYPipeSpecifications(IEnumerable<HYPipeSpecification> source) : base(source)
		{
		}

		public void GetAlDn(out SortedSet<int> dns)
		{
			dns = new SortedSet<int>();
			foreach (HYPipeSpecification hypipeSpecification in this)
			{
				dns.Add(hypipeSpecification.DN);
			}
		}

		public void WriteXml(XElement xe)
		{
			foreach (HYPipeSpecification hypipeSpecification in this)
			{
				XElement xelement = new XElement("Specification");
				hypipeSpecification.WriteXml(xelement);
				xe.Add(xelement);
			}
		}

		public void ReadXml(XElement xe)
		{
			this.Clear();
			foreach (XElement xe2 in xe.Elements("Specification"))
			{
				HYPipeSpecification hypipeSpecification = new HYPipeSpecification();
				hypipeSpecification.ReadXml(xe2);
				base.Add(hypipeSpecification);
			}
		}
	}
}
